package com.example.ec.controller;

import com.example.ec.service.CommodityService;
import com.example.ec.service.UserCommodityService;
import com.example.ec.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("userCommodity")
public class UserCommodityController extends BaseController{

    private final UserService userService;

    private final CommodityService commodityService;

    private final UserCommodityService userCommodityService;

    public UserCommodityController(UserService userService, CommodityService commodityService, UserCommodityService userCommodityService) {
        this.userService = userService;
        this.commodityService = commodityService;
        this.userCommodityService = userCommodityService;
    }

    @GetMapping("queryAll")
    private String queryAll(){
        session.setAttribute("userCommodities",userCommodityService.queryAll());
        return "redirect:/user.home.jsp";
    }
}
